fn main() {
    let file = File::new("d:/test.txt".to_owned());
    println!("read {}", file.read());
    file.close();
   // file.read();
}

#[derive(Debug)]
struct File {
    name: String
}


impl File {

    fn new(name: String) -> File {
        File{name}
    }

    fn read(&self) -> String {
        "hello".to_owned()
    }

    fn write(&self, data:&str) {
        println!("write {} to file", data);
    }

    fn close(self) {
        println!("file close");
    }
}